package com.woniu.supermarket.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.supermarket.entity.LoginLog;
import com.woniu.supermarket.mapper.LoginLogMapper;
import com.woniu.supermarket.service.ILoginLogService;
import com.woniu.supermarket.util.IpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Service
public class LoginLogImpl implements ILoginLogService {

    @Autowired
    LoginLogMapper loginLogMapper;

    @Override
    public PageInfo<LoginLog> findByCons(Integer now, Integer size, String name) {
        PageHelper.startPage(now,size);
        List<LoginLog> lists = loginLogMapper.selectByCons(name);
        return new PageInfo<>(lists);
    }

    @Override
    public int addLog(LoginLog loginLog) {
        return loginLogMapper.insert(loginLog);
    }

}
